<template>
  <div class="login-list clear">
    <div class="register-list">
      <div class="register-title">用户登录</div>
      <div class="register-bottom">
        <div>
          <i class="iconfont icon-yonghu">&#xe638;</i>
          <input v-model="phone" type="text" placeholder="手机号" class="dl">
        </div>
        <div>
          <i class="iconfont icon-yonghu">&#xe640;</i>
          <input v-model="pwd" type="password" placeholder="密码" class="dl">
        </div>
        <button @click="login" class="btn btn-dl cursor" style="cursor: pointer">立即登录</button>
        <p class="clear">
			<router-link tag="a" to="/login/forget" class="color27 fl">忘记密码</router-link>
			<router-link tag="a" to="/login/register" class="color27 fr">免费注册</router-link>
		</p>
      </div>
    </div>
  </div>
</template>

<script>
import Axios from "@/common/js/Axios";

export default {
  data(){
    return{
      phone:"",
      pwd:""
    }
  },
  methods:{
    login(){
      Axios.postAxios('/api/authorizations',{
        phone : this.phone,
        password : this.pwd
      }).then(res=>{
        localStorage.setItem("Authorization",res.data.access_token);        
        console.log(res)
        //路由跳转到用户页
        this.$router.push("/");
      },err=>{
        this.$message.error("请检查您的用户名或密码是否正确");
      })
    }
  }
};
</script>

<style lang="stylus" scoped>
@import '~@/assets/login/css/login';
</style>


